package mmc.objects;

import mmc.EngineObject;
import mmc.Scene;
import mmc.resource.Model;
import mmc.resource.ModelLoader;
import static org.lwjgl.opengl.GL11.*;

@SuppressWarnings("serial")
public class GenericColladaObject extends EngineObject{

	private transient Model model;
	
	public GenericColladaObject(float x, float y, float z) {
		super(x, y, z);
	}

	@Override
	public void initOnClient(Scene scene) {
		String smodel;
		
		switch((int)(Math.random()*1)){
		case 0:
			smodel = "mmc/resource/models/Seymour.dae"; 
			break;
		case 1:
			smodel = "mmc/resource/models/torus.dae"; 
			break;
		case 2:
			smodel = "mmc/resource/models/earth.dae"; 
			break;
		default:
			smodel = "mmc/resource/models/penguin.dae"; 
		}
		
		model = ModelLoader.load(smodel);
	}

	@Override
	public void render(EngineObject observer) {
		glPushMatrix();
		glTranslatef(x, y, z);
		model.render(observer);
		glPopMatrix();
	}

	@Override
	public void update(float dt) {
		
	}

	@Override
	public boolean copyTo(EngineObject o) {
		o.x = super.x;
		o.y = super.y;
		o.z = super.z;
		o.health = super.health;
		
		return true;
	}
}
